﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Interactivity;

namespace ViewMaker.Core.Silverlight
{
    /// <summary>
    /// ViewCommandを処理するヘルパーを設定するビヘイビア
    /// </summary>
    public class ViewCommandBehavior : Behavior<FrameworkElement>
    {
        public static readonly DependencyProperty HelperProperty = DependencyProperty.RegisterAttached("Helper", typeof(IViewCommandHelper), typeof(ViewCommandBehavior), new PropertyMetadata(HelperCallback));

        public IViewCommandHelper Helper
        {
            get { return (IViewCommandHelper)this.GetValue(HelperProperty); }
            set { this.SetValue(HelperProperty, value); }
        }

        private static void HelperCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {

        }

        protected override void OnAttached()
        {
            base.OnAttached();
            if (Helper != null) Helper.Attach(AssociatedObject);
        }

        protected override void OnDetaching()
        {
            base.OnDetaching();
            if (Helper != null) Helper.Detach();
        }



    }
}
